package com.bjpowernode.mvc.exception;

import com.bjpowernode.common.enums.RespCode;
import lombok.Data;

/**
 * 登录异常处理类
 * BizException异常的父类是RuntimeException异常
 */
@Data
public class BizException extends RuntimeException {
    private int code;
    private String msg;

    public BizException() {
        super();
    }

    public BizException(int code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public BizException(RespCode respCode) {
        //在创建BizException对象时同时传递异常信息给父类
        super(respCode.getMsg());
        this.code = respCode.getCode();
        this.msg = respCode.getMsg();
    }
}
